home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
util
/
cli
/
MiscCLICmds_CH.lha
/
GetDate.doc
< prev
next >
Wrap
Text File
|
1996-09-23
|
4KB
|
131 lines
GetDate V1.0 by Chris Hodges
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Introduction
~~~~~~~~~~~~
This little command allows extracting of more specific date data than the
original date command does. Can be quite useful for comparing dates in
batch scripts etc.
Requirements
~~~~~~~~~~~~
GetDate needs Kick 2.04 or higher.
Usage
~~~~~
GetDate [FILE filename] [TIME] [WEEKDAY] [INTERNATIONAL=INT|USA]
GetDate [FILE filename] [NUM] [DAYONLY|MONTHONLY|YEARONLY|WEEKDAYONLY]
GetDate [FILE filename] [NUM] [TIMEONLY|HOURSONLY|MINSONLY|SECSONLY]
Full template:
FILE/K,TIME/S,WEEKDAY=WD/S,NUMERIC=NUM/S,INTERNATIONAL=INT/S,USA/S,
DAYONLY=DO/S,MONTHONLY=MO/S,YEARONLY=YO/S,WEEKDAYONLY=WDO/S,TIMEONLY=TO/S,
HOURSONLY=HO/S,MINSONLY=MIO/S,SECSONLY=SO/S.
FILE/K:
If this keyword is given the date will be taken from the given file or
directory, otherwise the current date will be used.
TIME/S:
Prints out the time aswell if this switch given. If you only want to get
the time stamp, use TIMEONLY keyword.
WEEKDAY=WD/S:
Normally, the week day is ommitted. Use this switch to turn it on.
NUMERIC=NUM/S:
Normally, the date is returned as readable ascii string. The use of this
switch will print out the date as number of days since 01-Jan-78. This can
be useful for scripts, e.g if you want to find out, how much days a file
has not been touched. It has futher effect when used in conjunction with
the MONTHONLY, WEEKDAYONLY and TIMEONLY options.
INTERNATIONAL=INT/S:
Normally, the date string is created in the way AmigaDOS does (dd-mmm-yy).
This toggle switches to international date syntax (yy-mmm-dd). INT and USA
are mutually exclusive.
USA/S:
Normally, the date string is created in the way AmigaDOS does (dd-mmm-yy).
This toggle switches to american date syntax (mm-dd-yy). USA and INT are
mutually exclusive.
The following options are all mutually exclusive:
DAYONLY=DO/S:
If specified, GetDate only returns the day of the month.
MONTHONLY=MO/S:
If specified, only the name of the month is returned. If the NUM option is
also used, the number of the month will be returned instead.
YEARONLY=YO/S:
If specified, only the year will be returned.
WEEKDAYONLY=WDO/S:
Returns the name of the current day, if specified. If the NUM option is
also used, a number from 1 (Monday) to 7 (Sunday) is returned. You don't
have to use the WEEKDAY switch in conjunction with WEEKDAYONLY.
TIMEONLY=TO/S:
Only returns a time string if specified. If the NUM option is given, a
number is returned which represents the amount of minutes passed since
midnight. You don't have to use the TIME switch.
HOURSONLY=HO/S:
Returns the hours of the day, if specified.
MINSONLY=MIO/S:
Returns the number of minutes passed since the last full hour, if
specified.
SECSONLY=SO/S:
Returns the number of seconds in the current minute.
Examples
~~~~~~~~
1. Checks if the internal clock is going wrong (due to some program
overwriting the data and demanding correction by the user. Place in
user-startup.
If NOT EXISTS ENVARC:LastBootDate
GetDate >ENVARC:LastBootDate NUM
Else
GetDate >ENV:CurBootDate NUM
Eval >ENV:Result $CurBootDate-$LastBootDate
If VAL 100 GT $Result
If VAL 0 GT $Result
SYS:Prefs/Time
EndIf
Else
SYS:Prefs/Time
EndIf
Copy ENV:CurBootDate ENVARC:LastBootDate
Delete >NIL: ENV:Result ENV:CurBootDate
EndIf
2. Imagine you're using a timer to make a call to a bss from about 2 to 3
o'clock in the night. You can use this one to check if it's that late:
GetDate >ENV:Hour HOURSONLY
If VAL $Hour EQ 2
S:AutoNetcall
EndIf
History
~~~~~~~
V1.0 (23-Sep-96): First release.
Contact address
~~~~~~~~~~~~~~~
Any mails or donations to:
Chris Hodges Account: 359 68 63
Kennedystr. 8 BLZ : 700 530 70
D-82178 Puchheim Bank : Sparkasse Fürstenfeldbruck
Germany
Tel.: +49-89/8005856
Email: chris@sixpack.pfalz.de